<template>
  <div class="orderCard bgwrite">
    <!-- 内容 -->
    <div class="top">
      <div class="name fz2">{{form.orderName}}</div>
      <div class="content flex fz4">
        <div class="wordsGray">订单编号</div>
        <div class="code">{{form.code}}</div>
      </div>

      <div class="content flex fz4">
        <div class="wordsGray">设&ensp;计&ensp;师</div>
        <div class="con">{{form.suserName}}</div>
      </div>
      <div class="content flex fz4">
        <div class="wordsGray">作图数量</div>
        <div class="con">{{form.pictureNum}}</div>
      </div>
      <div class="content flex fz4">
        <div class="wordsGray">初次上门</div>
        <div class="con">{{form.homeTime}}</div>
      </div>
      <div class="content flex fz4" >
        <div class="wordsGray">预约日期</div>
        <div class="con">{{form.appointmentTime.join('、')}}</div>
      </div>
      <div class="content flex fz4">
        <div class="wordsGray">约定地点</div>
        <div class="con">{{form.address}}</div>
      </div>
      <div class="content flex fz4"
           v-show="form.subsist">
        <div class="wordsGray">预付金额</div>
        <div class="con">￥{{form.subsist}}</div>
      </div>
      <div class="content flex fz4">
        <div class="wordsGray">总计时间</div>
        <div class="con">{{form.totalTime}}</div>
      </div>
      <div class="content flex fz4"
           v-show="form.subsequentAmount">
        <div class="wordsGray">尾款金额</div>
        <div class="con">￥{{form.subsequentAmount}}</div>
      </div>
      <div class="content flex fz4"
           v-show="form.fineMoney">
        <div class="wordsGray">罚款金额</div>
        <div class="con">￥{{form.fineMoney}}</div>
      </div>

      <div class="content flex fz4"
           v-show="form.reason">
        <div class="wordsGray">投诉内容</div>
        <div class="con">{{form.reason}}</div>
      </div>
      <div class="content flex fz4"
           v-show="form.complaintHandling">
        <div class="wordsGray">投诉处理</div>
        <div class="con">{{form.complaintHandling}}</div>
      </div>
    </div>
    <!-- 右侧状态 -->

    <div class="rightimg">

      <img :src="url"
           v-if="showPic=='hasClose'"
           width="100%"
           alt="">
      <img :src="furl"
           v-else-if="showPic=='finished'"
           width="100%"
           alt="">
      <img :src="wurl"
           width="100%"
           v-else
           alt="">
    </div>

    <!-- 右侧状态end -->
    <!-- 点击聊天室 -->
    <div class="msg"
         @click="go_chat(form.groupUid,form.uid)"
         v-if="showPic!='hasClose'">
      <div class="dot"
           v-if="groupUids&&groupUids.includes(form.groupUid)">
        <img src="@/assets/img/performance/orderCard/dot.png"
             width="100%"
             alt="">
      </div>
      <img src="@/assets/img/performance/orderCard/itemMsg.png"
           width="100%"
           alt="">
    </div>
    <!-- 聊天室置灰-->
    <div class="msg"
         v-else>
      <img src="@/assets/img/performance/orderCard/noChat.png"
           width="100%"
           alt="">
    </div>
  </div>
</template>
<script>
import { setRemind, getRemind } from "@/utils/chat.js";
export default {
  props: ["form", "showPic"],
  data() {
    return {
      groupUids: getRemind(),
      url: require("@/assets/img/performance/orderCard/hasClose.png"),
      furl: require("@/assets/img/performance/orderCard/finished.png"),
      wurl: require("@/assets/img/performance/orderCard/waitService.png")
    };
  },
  methods: {
    go_chat(id, orderId) {
      if (this.groupUids) {
        this.groupUids.includes(id) &&
          this.groupUids.splice(this.groupUids.findIndex(gid => gid == id), 1);
      }
      setRemind(this.groupUids);
      this.$router.push({
        path: "/performance/chat",
        query: {
          id,
          orderId
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.orderCard {
  position: relative;
  width: 94%;
  margin: auto;
  box-shadow: 0px 2px 8px 4px rgba(216, 216, 216, 0.5);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.24rem;
  .top {
    padding: 0.4rem 0.24rem;
    .name {
      font-weight: bold;
      margin-bottom: 0.1rem;
      width: calc(100% - 1.4rem);
      height: 0.58rem;
      overflow: hidden; /*超出部分隐藏*/
      white-space: nowrap; /*不换行*/
      text-overflow: ellipsis; /*超出部分文字以...显示*/
    }
    .content {
      margin-top: 0.2rem;
      div:first-child {
        width: 1.35rem;
      }
       .code {
        width: calc(100% - 2.35rem);
        word-wrap: normal;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }
     .con{
        width: calc(100% - 1.35rem)
      }
     
    }
  }
  .bot {
    background-color: #eff4ff;
    height: 1.08rem;
    //
    .botleft {
      width: 50%;
      align-items: center;
      justify-content: center;
      .tit {
        margin-right: 0.15rem;
      }
      .timeclock {
        width: 0.6rem;
        height: 0.6rem;
        border-radius: 6px;
        font-weight: 600;
        text-align: center;
        line-height: 0.6rem;
      }
      .bgstart {
        background-color: #dfe8ff;
      }
      .dots {
        font-weight: 600;
      }
    }
    .botright {
      align-items: center;
      justify-content: center;
      width: 50%;
      .arrowRight {
        position: relative;
        top: 0.03rem;
        width: 0.24rem;
        margin-left: 0.16rem;
      }
      .service {
        height: 1.08rem;
        line-height: 1.08rem;
        width: 100%;
        text-align: center;
        background-color: #dfe8ff;
      }
      /* 已关闭 */
      .close {
        height: 1.08rem;
        line-height: 1.08rem;
        width: 100%;
        text-align: center;
      }
      /* 待签到 */
      .nosign {
        color: #cccccc;
      }
      /* 待开始 */
      .rbgstart {
        width: 100%;
        height: 100%;
        line-height: 1.08rem;
        text-align: center;
        background-color: #dfe8ff;
      }
    }
    .unclick {
      background-color: #dfe8ff;
    }
  }
  .rightimg {
    position: absolute;
    width: 1.2rem;
    top: 0;
    right: 0;
  }
  .msg {
    position: absolute;
    width: 0.9rem;
    top: 1rem;
    right: 0.3rem;
    .dot {
      position: absolute;
      right: 0.12rem;
      top: 0.12rem;
      width: 0.22rem;
    }
  }
}
</style>
